package com.es.controller;

import com.es.entity.Student;
import com.es.entity.Teacher;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.ArrayList;
import java.util.List;

@Controller
public class SpringMVCController {
    @RequestMapping("/index")
    public String index(){
        return "liangyu";
    }

    @RequestMapping("/simpleParams")
    public String simpleParams(String name, Integer age){
        System.out.println("姓名:"+name);
        System.out.println("年龄:"+age);
        return "liangyu";
    }
    @RequestMapping("/arrayParams")
    public String array(String[] likes){
        if(likes!=null){
            System.out.println(String.join("\n",likes));
        }
        return "liangyu";
    }

    @RequestMapping("/pojoParams")
    public String pojo(Student student){
        System.out.println(student);
        return "liangyu";
    }

    @RequestMapping("/teaParams")
    public String teaParam(Teacher teacher){
        System.out.println(teacher);
        return "liangyu";
    }

}
